<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jspf/taglibs.jspf"%>
<%@ page trimDirectiveWhitespaces="true" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>密码修改</title>
</head>
<body>
<div class="p-h-md p-v bg-white box-shadow pos-rlt ng-scope">
  <c:if test="${ erro!=null }">
  <div class="row">
    <div class="col-md-2 col-md-offset-4">
          <div class="panel panel-success">
        		<div class="panel-heading">
            ${erro }
        </div>
        </div>
    </div>
  </div>
  </c:if>
	<h3 class="no-margin">密码修改</h3>
<div class="p-md" >
	<form:form  modelAttribute="form" class="form-horizontal" method="post">
		<div class="panel panel-default">
			<div class="panel-body">
				<div class="col-sm-6" style="margin:0 0 0 30%">
					<div class="form-group">
	        			<label>原密码</label>
	        			<form:password path="oldPassword" maxlength="50" data-placement="top"  cssClass="form-control w-xxl w-full-xs"   required="required"/>
	    			</div>
				
					<div class="form-group">
	        			<label>新密码</label>
	        			<form:password path="newPassword" maxlength="50" data-placement="top" cssClass="form-control w-xxl w-full-xs"   required="required"/>
	     			</div>
	      
	      			<div class="form-group">
	        			<label>新密码</label>
	        			<form:password path="newPassword2" maxlength="50" data-placement="top" cssClass="form-control w-xxl w-full-xs"  required="required"/>
	      			</div>
	      			<div class="text-center">
						<button type="submit" class="btn btn-primary" >提 交</button>
	        			<button class="btn btn-default" id="reset" type="button">重 置</button>
	      			</div>
	      		</div>
	      	</div>
	     </div>
	</form:form>
	</div>
</div>
<script type="text/javascript" >
  $(document).ready(function() {
	  $("#reset").click(function(){
		  window.location.reload();
	  })
	  $("#form").validate({
	     	rules: {
	     		oldPassword: {
	     			required:true,rangelength:[6,15],
			    	//异步验证
			    	remote: {
			    	    url: "/profile/checkout_password",     //后台处理程序
			    	    type: "get",               //数据发送方式
						dataType: "html",           //接受数据格式   
			    	    data: {                     //要传递的数据
			    	    	oldPassword: function() {
			    	            return $("#oldPassword").val();
			    	        }
			    	    },
			    	    dataFilter:function(data,type){
			    	    	if(data=="true"){
			    	    		return false;
			    	    	}
			    	    	else{
			    	    		return true;	    	    		
			    	    	}
			    	    }
			    	},	 
		   		},
			    newPassword: {required: true,minlength: 6},
			    newPassword2: {required: true,minlength:6,equalTo: "#newPassword"}
		   },
		   messages: { 
		    	oldPassword: {required:"请输入旧密码", rangelength:"请输入不少于6~15位的密码",remote:"密码不正确"},
		    	newPassword: {required: "请输入密码",minlength: "密码不能小于6个字符"},
		    	newPassword2: {required: "请输入确认密码",minlength: "确认密码不能小于6个字符",equalTo: "两次输入密码不一致不一致"}
		   }
	});
  });
  </script>
</body>
</html>